<!doctype html> 
<html lang="en"> 
<head> 
	<title>撞球</title>
	<meta name="keywords" content="撞球"/>
	<meta name="description" content="撞球"/>
	<meta name="viewport" content="width=device-width; initial-scale=1; maximum-scale=1;" />
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <style type="text/css">*{margin: 0;padding:0;}html,body{width:100%;height:100%;overflow:hidden;}canvas{position: absolute;left: 50%;top: 50%;transform: translate(-50%,-50%);-webkit-transform: translate(-50%,-50%);}</style>
</head>
<body>
<script type="text/javascript" src="../phaser.min.js"></script>
<script type="text/javascript">
var conf = {
	screenWidth:92.5,   //屏宽为92.5CM
    screenHeight:52,    //屏高为52CM
	heatmapTime:500,//热区值记录时间，以毫秒为单位
	sound:50,//音量百分比
	gamePause:false,//是否暂停游戏
	musicList:0,//播发到第几首歌曲
	musicFade:[10,10]//音乐淡入淡出时间：musicFade[0]=开始到最高音量秒数，musicFade[1]=结束前几秒开始淡化音量
};
var gameSet={
	width: 1920,
    height: 1080,
	field:[
		{name:'线的宽度',value:10},
		{name:'线的颜色',value:'0xe7f1f0'},
		{name:'球场的背景颜色',value:'#016b5d'}
	]
}
var ball=function(x,y,style,drag,bx){
	//新建精灵
	this.sprite = game.add.sprite(x, y, style);
	game.physics.enable(this.sprite, Phaser.Physics.ARCADE);
	//开启世界边界碰撞
	this.sprite.body.collideWorldBounds = true;
	//是否可以拖曳
	if(drag){
		this.sprite.inputEnabled = true;
		this.sprite.input.enableDrag();
		this.sprite.input.priorityID = 10;
		
		//设置球拖动的范围
		bounds = new Phaser.Rectangle(bx,106, 960,974);
		graphics = game.add.graphics(bounds.x, bounds.y);
		graphics.beginFill(0x000077);
		graphics.drawRect(0, 0,  bounds.width, bounds.height);
		graphics.alpha=0;
		this.sprite.input.boundsRect = bounds;
	}
	return this.sprite
}
</script>
<script type="text/javascript" src="js/main.js"></script>
</body>
</html>